<?php if (!defined('THINK_PATH')) exit();?><style>
    .pageFormContent p{
        float:none;
    }



    .yuns label{
        width:auto;
        padding:0px 10px;
    }

    .pageFormContent .textInput{
        width:40px;
        float:none;
    }

    .pageFormContent p{
        width:auto;
    }

    ._citys {    display:none; background: #fff;width: 450px; z-index:1000;display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
    ._citys span { color: #56b4f8; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #56b4f8; cursor: pointer; }
    ._citys0 { width: 100%; height: 34px; display: inline-block; border-bottom: 2px solid #56b4f8; padding: 0; margin: 0; }
    ._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
    .citySel { background-color: #56b4f8; color: #fff !important; }
    ._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
    ._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 13px; overflow: hidden; }
    ._citys1 a:hover { color: #fff; background-color: #56b4f8; }
    .AreaS { background-color: #56b4f8 !important; color: #fff !important; }



</style>
<div class="pageContent">

    <form method="post" action="index.php?c=Fare&a=AddOne" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">

        <div class="pageFormContent" layoutH="56">
            <div style="padding-bottom:20px;border-bottom:1px solid #eaeaea">添加运费模板:</div>
            <p>
                <label>模板名称：</label>
                <input name="name" type="text" size="30" class="required" style="width:100px;" />
            </p>
			
			<p>
                <label>商家id：</label>
                <select name="shopid">
                    <?php if(is_array($shopList)): $i = 0; $__LIST__ = $shopList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$shopItem): $mod = ($i % 2 );++$i;?><option  value="<?php echo ($shopItem["shopid"]); ?>"><?php echo ($shopItem["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </p>
            <p>
                <label>发货时间：</label>

                <select name="deliverytime">
                    <?php if(is_array($classifyList)): $i = 0; $__LIST__ = $classifyList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$classify): $mod = ($i % 2 );++$i;?><option  value="<?php echo ($classify["time"]); ?>"><?php echo ($classify["time"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>

            </p>
            <p>
                <label>是否包邮：</label>

                <input type="radio" name="isPay" value="0" checked="checked" class="isP"/>自定义运费
                <input type="radio" name="isPay" value="1" class="isP"/>卖家承担运费
            </p>

            <div id="myPay">
                <p>
                    <label>计价方式：</label>
                    <input type="radio" name="Paymethod" value="0" checked="checked" class="payM"/>按件数
                    <!-- <input type="radio" name="Paymethod" value="1" class="payM"/>按重量 -->
                </p>

                <div style="border:1px solid dodgerblue;padding:20px;" class="yuns" id="jian">
                    <label>默认运费：</label>
                    <input type="text" name="area1[]"  value="0" hidden="hidden"/>
                    <input type="text" name="begincount1[]" value="1"/>件内,
                    <input type="text" name="fare1[]"  value=""/>多少元，
                    每增加<input type="text" name="quantity1[]"  value="1"/>件增加运费
                    <input type="text" name="addfare1[]"  value=""/>元

                    <div style="display:block;color:blue;margin-top:10px;margin-left:10px;cursor: pointer" class="addMore">为指定地点设置运费</div>
                </div>

                <div style="border:1px solid dodgerblue;padding:20px;display:none" class="yuns" id="zhong">
                    <label>默认运费：</label>
                    <input type="text" name="area[]"  value="0" hidden="hidden"/>
                    <input type="text" name="begincount[]"  value="1"/>kg内,
                    <input type="text" name="fare[]"  value=""/>多少元，
                    每增加<input type="text" name="quantity[]"  value="1"/>kg增加运费
                    <input type="text" name="addfare[]"  value=""/>元

                    <div style="display:block;color:blue;margin-top:10px;margin-left:10px;cursor: pointer" class="addMore">为指定地点设置运费</div>
                </div>
            </div>


        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
                <li>
                    <div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
                </li>
            </ul>
        </div>
    </form>
</div>

<script>


    $(function(){
        var $jian = $("#jian");
        var $zhong = $("#zhong");
        $('.payM').click(function(){
            var index = $(this).index();

            if(index == 1){
                $jian.css('display','block');
                $zhong.css('display','none');
            }else{
                $jian.css('display','none');
                $zhong.css('display','block');
            }
        });

        $('.isP').each(function(index){
            $(this).click(function(){
                if(index == 0){
                    $("#myPay").css('display','block');
                }else{
                    $("#myPay").css('display','none');
                }
            })
        });

        $('.addMore').each(function(index){
            $(this).click(function(){
                if(index==0){
                    $newNode = $('<p style="margin-left:10px">'+
                        '<input type="text" name="area1[]" value="" style="width: 150px" class="city required"/>'+
                        '<label style="float:none">默认运费：</label>'+
                        '<input type="text" name="begincount1[]" value="1" class="required" style="width:40px;"/>件内,'+
                        '<input type="text" name="fare1[]" class="required" value="" style="width:40px;"/>多少元，'+
                        '每增加<input type="text" name="quantity1[]"  class="required"  style="width:40px;" value="1"/>件增加运费'+
                        '<input type="text" name="addfare1[]"  class="required" style="width:40px;" value=""/>元'+
                        '<span style="margin-left:10px;font-size:12px;color:blue;cursor: pointer" id="rem" >删除</span>'+
                        '</p>');
                    $newNode.insertBefore($(this));

                    $newNode.find("#rem").click(function(e){
                        $(this).parent().remove();
                        e.stopPropagation();
                    })
                    $newNode.find('.city').click(function (e) {
                        SelCity(this,e);
                        console.log("inout",$(this).val(),new Date())
                    });
                }else if(index==1){
                    $newNode = $('<p style="margin-left:10px">'+
                        '<input type="text" name="area[]" value="" style="width: 150px" class="city required"/>'+
                        '<label style="float:none">默认运费：</label>'+
                        '<input type="text" name="begincount[]" value="1" class="required" style="width:40px;"/>kg内,'+
                        '<input type="text" name="fare[]" class="required" value="" style="width:40px;"/>多少元，'+
                        '每增加<input type="text" name="quantity[]"  class="required"  style="width:40px;" value="1"/>kg增加运费'+
                        '<input type="text" name="addfare[]"  class="required" style="width:40px;" value=""/>元'+
                        '<span style="margin-left:10px;font-size:12px;color:blue;cursor: pointer" id="rem" >删除</span>'+
                        '</p>');
                    $newNode.insertBefore($(this));

                    $newNode.find("#rem").click(function(e){
                        $(this).parent().remove();
                        e.stopPropagation();
                    })
                    $newNode.find('.city').click(function (e) {
                        SelCity(this,e);
                        console.log("inout",$(this).val(),new Date())
                    });
                }
            })
        });

    })





</script>